package sk.naive.talker.props;

import sk.naive.talker.util.Utils;

import java.util.Set;

/**
 *
 * @author <a href="mailto:richter@bgs.sk">Richard Richter</a>
 * @version $Revision: 1.8 $ $Date: 2004/04/24 18:43:21 $
 */
public class UserNameProperty extends SimpleProperty {
	public boolean checkValue(Object o) {
		if (!(o instanceof String)) {
			return false;
		}
		String login = Utils.normalize((String) o);
		for (int i = 0; i < login.length(); i++) {
			char c = login.charAt(i);
			if (c < 'a' || c > 'z') {
				return false;
			}
		}
		return true;
	}

	public Object defaultValue() {
		return null;
	}

	public Set validValues() {
		throw new UnsupportedOperationException();
	}
}
